<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
  通过history对象实现网页的前进和后退
-->

<h1>history01</h1>
<button>跳转页面</button>
<button>前进</button>
<button>前进2</button>

<script>
    document.querySelector('button').onclick =function (){
       window.location.href = "06-history02.html"
    }

    document.querySelectorAll('button')[1].onclick = function () {
        // 前进
        window.history.forward()
    }

    document.querySelectorAll('button')[2].onclick = function () {
        // 前进  参数  2  前进2步  -2 后退2步
        window.history.go(2)
    }
</script>
</body>
</html>
